/**
 * Copyright (c) 2016-2019 人人开源 All rights reserved.
 *
 * https://www.renren.io
 *
 * 版权所有，侵权必究！
 */

package io.renren.modules.sys.controller;

import io.renren.modules.sys.entity.SysUserEntity;
import io.renren.modules.sys.entity.SysUserTokenEntity;
import io.renren.modules.sys.service.ShiroService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Set;

/**
 * 系统用户
 *
 * @author Mark sunlightcs@gmail.com
 */
@RestController
@RequestMapping("/shiro")
public class ShiroController extends AbstractController {
	@Autowired
	private ShiroService shiroService;

	@GetMapping("getUserPermissions/{userId}")
	public Set<String> getUserPermissions(@PathVariable Long userId){
		return shiroService.getUserPermissions(userId);
	}
	@GetMapping("queryByToken/{accessToken}")
	SysUserTokenEntity queryByToken(@PathVariable String accessToken){
		return shiroService.queryByToken(accessToken);
	}
	@GetMapping("queryUser/{userId}")
	SysUserEntity queryUser(@PathVariable Long userId){
		return shiroService.queryUser(userId);
	}

}
